import request from '@/config/axios'

export interface TokenVO {
        id: number
        accountId: number
        channelId: number
        accessToken: string
        refreshToken: string
        expireIn: number
        expireAt: Date
}

// 查询账户token列表
export const getTokenPage = async (params) => {
    return await request.get({url: `/ad/token/page`, params})
}

// 查询账户token详情
export const getToken = async (id: number) => {
    return await request.get({url: `/ad/token/get?id=` + id})
}

// 新增账户token
export const createToken = async (data: TokenVO) => {
    return await request.post({url: `/ad/token/create`, data})
}

// 修改账户token
export const updateToken = async (data: TokenVO) => {
    return await request.put({url: `/ad/token/update`, data})
}

// 删除账户token
export const deleteToken = async (id: number) => {
    return await request.delete({url: `/ad/token/delete?id=` + id})
}

// 导出账户token Excel
export const exportToken = async (params) => {
    return await request.download({url: `/ad/token/export-excel`, params})
}